home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_ctrllever3.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  326 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_CtrlLever3.cog
  4. #
  5. # Sets up lever3 in the "pushed" possition (ready for pull) at level start.
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     message     startup
  15.     message     user0
  16.     message     activated
  17.    
  18.     thing       player          local
  19.     thing       leverGhost      # Lever position
  20.     thing       indy            # Actor Indy
  21.     thing       trkSwitch       # Track switch
  22.     thing       panelTarget     # focus for control panel
  23.     
  24.     thing       switchCam       # Switch cam
  25.     thing       ctrlCam1        # Control panel cam
  26.  
  27.     thing       pushed          local
  28.     thing       pulled          local
  29.     
  30.     thing       offsetCam
  31.     
  32.     surface     switch          # Switch panel texture
  33.     
  34.     # Track faces -- A straight -- B turn off
  35.     surface     switchA    
  36.     surface     switchB      
  37.     
  38.     template    tplLevPull=pullever          local
  39.     template    tplLevPush=pushlever         local
  40.     
  41.     keyframe    leverPull=gen_lever_pull.key        local
  42.     keyframe    leverPush=gen_lever_push.key        local
  43.     
  44.     keyframe    indyPull=in_pull_lever.key          local
  45.     keyframe    indyPush=in_push_lever.key          local
  46.     
  47.     sound       sndLever=gen_lever_pull.wav             local
  48.     sound       sndSwitchTex=sol_panel_switch_c.wav     local
  49.     sound       inJuice=Sl02j04.wav                     local
  50.     
  51.     cog         hintCog
  52.     
  53.     int         powerOn=0       local
  54.     int         ready=1         local
  55.     int         playing=0       local
  56.     int         curCam          local
  57.     int         sound2          local
  58.     
  59.     # ** subroutines **
  60.     flex        pullLever       local
  61.     flex        pushLever       local
  62.     flex        noPower         local
  63.     
  64. end
  65.  
  66. # ========================================================================================
  67.  
  68. code
  69.  
  70. startup:
  71.  
  72.     pushed = CreateThing(tplLevPull, leverGhost);
  73.     CaptureThing(pushed);
  74.     
  75.     # Mine car track -- Turn off
  76.     ClearSurfaceFlags(switchA, 0x4000);
  77.     SetSurfaceFlags(switchB, 0x4000);
  78.     Sleep(0.5);
  79.     
  80.     return;
  81.  
  82. # ========================================================================================
  83.  
  84. user0:
  85.  
  86.     powerOn = 1;
  87.     return;
  88.  
  89. # ========================================================================================
  90.  
  91. activated:
  92.  
  93.     Print("activated: ctrlLever3");
  94.     
  95.     player = GetLocalPlayerThing();
  96.     curCam = GetCurrentCamera();
  97.  
  98.     # no power
  99.     if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (!powerOn) && (!playing))
  100.     {
  101.         playing = 1;
  102.         Call noPower;
  103.     }
  104.         
  105.     # pull lever
  106.     else if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (powerOn) && (ready))
  107.     {
  108.         ready = 0;
  109.         Call pullLever;
  110.     }
  111.         
  112.     # push lever
  113.     else if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (powerOn) && (ready))
  114.     {
  115.         ready = 0;
  116.         Call pushLever;
  117.     }
  118.  
  119.     return;
  120.         
  121. # ========================================================================================
  122.  
  123. pullLever:
  124.  
  125.     # do cutscene stuff
  126.     MakeMeStop();
  127.     StartCutscene(2);
  128.     
  129.     # switch to offsetCam
  130.     SetCameraFocus(2, offsetCam);
  131.     SetCameraSecondaryFocus(2, player);
  132.     SetCurrentCamera(2);
  133.     SetCameraFOV(90, 0, 0.0);
  134.     
  135.     # put away any weapon
  136.     DeselectWeaponWait(player);
  137.     
  138.     # outfit Indy actor
  139.     CopyPlayerHolsters(player, indy);
  140.     
  141.     # show actor hide player
  142.     SetThingFlags(player, 0x80000);
  143.     ClearThingFlags(indy, 0x80000);
  144.     
  145.     # pull the lever
  146.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  147.     PlayKey(indy, indyPull, 4, 0x12, 0);
  148.     Sleep(0.85);
  149.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  150.     
  151.     # Cut to Control Panel cam
  152.     SetCameraFocus(2, ctrlCam1);
  153.     SetCameraSecondaryFocus(2, panelTarget);
  154.     SetCurrentCamera(2);
  155.     SetCameraFOV(90, 0, 0.0);
  156.     Sleep(0.5);
  157.     
  158.     # flip panel switch texture
  159.     SetWallCel(switch, 2);
  160.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  161.     WaitForSound(sound2);
  162.     Sleep(0.5);
  163.     
  164.     # Cut to switch cam
  165.     SetCameraFocus(2, switchCam);
  166.     SetCameraSecondaryFocus(2, trkSwitch);
  167.     SetCurrentCamera(2);
  168.     
  169.     # rotate track switch
  170.     SetCameraFOV(90, 0, 0.0);
  171.     Rotate(trkSwitch, -90, 1, 1.0);
  172.     Sleep(2.0);
  173.     
  174.     # hide indy show player
  175.     SetThingFlags(indy, 0x80000);
  176.     ClearThingFlags(player, 0x80000);
  177.     
  178.     # stop any unfinished animations
  179.     ResetThing(indy);
  180.     
  181.     # restore controls
  182.     ClearActorFlags(player, 0x200000);
  183.     
  184.     # restore camera
  185.     SetCurrentCamera(curCam);
  186.     
  187.     # Destroy old lever and create a new one
  188.     DestroyThing(pushed);
  189.     pulled = CreateThing(tplLevPush, leverGhost);
  190.     CaptureThing(pulled);
  191.     
  192.     # Mine Track -- Go Straight
  193.     SetSurfaceFlags(switchA, 0x4000);
  194.     ClearSurfaceFlags(switchB, 0x4000);
  195.     
  196.     EndCutscene();
  197.     ready = 1;
  198.     
  199.     # tell hintCog to check switch positions
  200.     SendMessage(hintCog, user1);
  201.     
  202.     return;
  203.  
  204. # ========================================================================================
  205.  
  206. pushLever:
  207.  
  208.     # do cutscene stuff
  209.     MakeMeStop();
  210.     StartCutscene(2);
  211.     
  212.     # switch to offsetCam
  213.     SetCameraFocus(2, offsetCam);
  214.     SetCameraSecondaryFocus(2, player);
  215.     SetCurrentCamera(2);
  216.     SetCameraFOV(90, 0, 0.0);
  217.     
  218.     # put away any weapon
  219.     DeselectWeaponWait(player);
  220.     
  221.     # outfit Indy actor
  222.     CopyPlayerHolsters(player, indy);
  223.     
  224.     # show actor hide player
  225.     SetThingFlags(player, 0x80000);
  226.     ClearThingFlags(indy, 0x80000);
  227.     
  228.     # push the lever
  229.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  230.     PlayKey(indy, indyPush, 4, 0x12, 0);
  231.     Sleep(0.75);
  232.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  233.     
  234.     # Cut to Control Panel cam
  235.     SetCameraFocus(2, ctrlCam1);
  236.     SetCameraSecondaryFocus(2, panelTarget);
  237.     SetCurrentCamera(2);
  238.     SetCameraFOV(90, 0, 0.0);
  239.     Sleep(0.5);
  240.     
  241.     # flip panel switch texture
  242.     SetWallCel(switch, 1);
  243.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  244.     WaitForSound(sound2);
  245.     Sleep(0.5);
  246.     
  247.     # Cut to switch cam
  248.     SetCameraFocus(2, switchCam);
  249.     SetCameraSecondaryFocus(2, trkSwitch);
  250.     SetCurrentCamera(2);
  251.     SetCameraFOV(90, 0, 0.0);
  252.     
  253.     # rotate track switch
  254.     Rotate(trkSwitch, 90, 1, 1.0);
  255.     Sleep(2.0);
  256.     
  257.     # hide indy show player
  258.     SetThingFlags(indy, 0x80000);
  259.     ClearThingFlags(player, 0x80000);
  260.     
  261.     # stop any unfinished animations
  262.     ResetThing(indy);
  263.     
  264.     # restore controls
  265.     ClearActorFlags(player, 0x200000);
  266.     
  267.     # restore camera
  268.     SetCurrentCamera(curCam);
  269.     
  270.     # Destroy old lever and create a new one
  271.     DestroyThing(pulled);
  272.     pushed = CreateThing(tplLevPull, leverGhost);
  273.     CaptureThing(pushed);
  274.     
  275.     # Mine Track -- turn off
  276.     SetSurfaceFlags(switchB, 0x4000);
  277.     ClearSurfaceFlags(switchA, 0x4000);
  278.     
  279.     EndCutscene();
  280.     ready = 1;
  281.     
  282.     # tell hintCog to check switch positions
  283.     SendMessage(hintCog, user1);
  284.     
  285.     return;
  286.     
  287. # ========================================================================================
  288.  
  289. noPower:
  290.  
  291.     # do cutscene stuff
  292.     MakeMeStop();
  293.     StartCutscene(2);
  294.     
  295.     # switch to offsetCam
  296.     SetCameraFocus(2, offsetCam);
  297.     SetCameraSecondaryFocus(2, player);
  298.     SetCurrentCamera(2);
  299.     SetCameraFOV(90, 0, 0.0);
  300.     
  301.     # put away any weapon
  302.     DeselectWeaponWait(player);
  303.     
  304.     # activate lever
  305.     PlayMode(player, 60, 0);
  306.     Sleep(0.3);
  307.     
  308.     # say line
  309.     PlayVoice(player, inJuice, 1.0, 1);
  310.     Sleep(0.5);
  311.     
  312.     # restore controls and camera
  313.     ClearActorFlags(player, 0x200000);
  314.     SetCurrentCamera(curCam);
  315.     
  316.     EndCutscene();
  317.     
  318.     playing = 0;
  319.     
  320.     return;
  321.  
  322. # ========================================================================================
  323.  
  324. end
  325.  
  326.